package com.guanghua.brick.html.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class CoreIteratorEmptyMsgTag extends BodyTagSupport {
	
private static Log logger = LogFactory.getLog(CoreIteratorEmptyMsgTag.class);
	
	private String id = null;

	public int doEndTag() throws JspException {
		Boolean empty = (Boolean)pageContext.getRequest().getAttribute(this.id);
		if (empty != null && empty.booleanValue()) {
			try {
				pageContext.getOut().write(bodyContent.getString());
			} catch (IOException e) {
				logger.error("io exception on print iterator empty msg tag", e);
			}
		}
		
		return BodyTagSupport.EVAL_PAGE;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

}
